<?php
$this->breadcrumbs=array(
	'Payouts'=>array('/payouts'),
	'Yearweek',
);?>
<h1>Generate Business Volumes </h1>

<?php
if ( !isset($_GET['year']) ) {
  $p_year = date("Y"); 	
}
else  {
  $p_year = $_GET['year'];	
}

if ( !isset($_GET['month_no']) ) {
  $p_month = date("n"); 	
}
else  {
  $p_month = $_GET['month_no'];	
}

$target = Yii::app()->request->baseUrl . "/?r=Payouts/admin";
?>

<form method="post" action="<?php echo $target?>">
	
	Select Month:
	<select name="year">
		<?php 
		  $year_start = 2012;
          $year_now = date("Y");
          $year = $year_now;
		  while ( $year >= $year_start ) { 
		  	 if ( $year == $p_year) {?>		
		        <option value="<?php echo $year?>" selected="selected"> <?php echo $year?></option>
		     <?php } else { ?>
		     	<option value="<?php echo $year?>"> <?php echo $year?></option>
		     <?php } ?>
		<?php $year--; }?>
	</select>
	<select name="month_no">
		<?php 
		  $month[1] = "January";
		  $month[2] = "Febuary";
		  $month[3] = "March";
		  $month[4] = "April";
		  $month[5] = "May";
		  $month[6] = "June";
		  $month[7] = "July";
		  $month[8] = "August";
		  $month[9] = "September";
		  $month[10] = "October";
		  $month[11] = "November";
		  $month[12] = "December";

		  foreach( $month as $n => $name ) {
		  	 if ( $n == $p_month) {?>		
		        <option value="<?php echo $n?>" selected="selected"> <?php echo $name?></option>
		     <?php } else { ?>
		     	<option value="<?php echo $n?>"> <?php echo $name?></option> 
		     <?php } 
		  }?>

	</select>
	<input type="submit" value="Generate Payouts" />
</form>